const { resolve } = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { DefinePlugin } = require('webpack');
module.exports = {
  entry: './src',
  output: {
    filename: "js/[name].js",
    path: resolve(__dirname, 'dist'),
  },

  plugins: [
      new CleanWebpackPlugin(),
      new HTMLWebpackPlugin({
        title: "Webpack App",
      }),
      new DefinePlugin({
        BASE_URL: "'./'"
      }),
  ],

  mode: 'development',
  devtool: 'source-map'
  /**
   * eval: 不生成source-map文件
   * cheap-source-map:不生成列报错，只生成行报错
   * cheap-module-source-map: (整体，没有单独的module)，类似于cheap-source-map，但是对源自loader的sourcemap处理会更
   */
}